package com.ktgj.customer.service.impl;

import java.util.List;
import com.ktgj.common.core.utils.DateUtils;
import com.ktgj.customer.domain.MallActivityProductDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktgj.customer.mapper.MallActivityProductMapper;
import com.ktgj.customer.domain.MallActivityProduct;
import com.ktgj.customer.service.IMallActivityProductService;

/**
 * 活动商品Service业务层处理
 * 
 * @author ruoyi
 * @date 2022-05-30
 */
@Service
public class MallActivityProductServiceImpl implements IMallActivityProductService 
{
    @Autowired
    private MallActivityProductMapper mallActivityProductMapper;

    /**
     * 查询活动商品
     * 
     * @param activityProductId 活动商品ID
     * @return 活动商品
     */
    @Override
    public MallActivityProduct selectMallActivityProductById(Long activityProductId)
    {
        return mallActivityProductMapper.selectMallActivityProductById(activityProductId);
    }

    /**
     * 查询活动商品列表
     * 
     * @param mallActivityProduct 活动商品
     * @return 活动商品
     */
    @Override
    public List<MallActivityProduct> selectMallActivityProductList(MallActivityProduct mallActivityProduct)
    {
        return mallActivityProductMapper.selectMallActivityProductList(mallActivityProduct);
    }

    /**
     * 新增活动商品
     * 
     * @param mallActivityProduct 活动商品
     * @return 结果
     */
    @Override
    public int insertMallActivityProduct(MallActivityProduct mallActivityProduct)
    {
        mallActivityProduct.setCreateTime(DateUtils.getNowDate());
        return mallActivityProductMapper.insertMallActivityProduct(mallActivityProduct);
    }

    /**
     * 修改活动商品
     * 
     * @param mallActivityProduct 活动商品
     * @return 结果
     */
    @Override
    public int updateMallActivityProduct(MallActivityProduct mallActivityProduct)
    {
        mallActivityProduct.setUpdateTime(DateUtils.getNowDate());
        return mallActivityProductMapper.updateMallActivityProduct(mallActivityProduct);
    }

    /**
     * 批量删除活动商品
     * 
     * @param activityProductIds 需要删除的活动商品ID
     * @return 结果
     */
    @Override
    public int deleteMallActivityProductByIds(Long[] activityProductIds)
    {
        return mallActivityProductMapper.deleteMallActivityProductByIds(activityProductIds);
    }

    /**
     * 删除活动商品信息
     * 
     * @param activityProductId 活动商品ID
     * @return 结果
     */
    @Override
    public int deleteMallActivityProductById(Long activityProductId)
    {
        return mallActivityProductMapper.deleteMallActivityProductById(activityProductId);
    }

    //活动商品
    @Override
    public List<MallActivityProductDetails> mallActivityProducts(Long activityId) {
        return mallActivityProductMapper.mallActivityProducts(activityId);
    }
}
